package com.easemob.cloud;

import com.easemob.chat.EMChat;
import com.easemob.chat.EMChatConfig;
import com.easemob.chat.core.f;
import com.easemob.chat.core.f.c;
import org.apache.http.impl.DefaultConnectionReuseStrategy;
import org.apache.http.impl.client.DefaultConnectionKeepAliveStrategy;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpProtocolParams;

public class HttpClientConfig
{
  private static final String EASEMOB_USERSERVER_DOMAIN_ID = "easemob.com";
  private static final String EASEMOB_PLATFORM = "Android";

  public static String getEaseMobUserServerDomainId()
  {
    return "easemob.com";
  }

  private static String getDefaultUserAgent()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    localStringBuffer.append("Easemob-SDK(");
    localStringBuffer.append("Android");
    localStringBuffer.append(") ");
    localStringBuffer.append(EMChat.getInstance().getVersion());
    return localStringBuffer.toString();
  }

  public static DefaultHttpClient getDefaultHttpClient()
  {
    BasicHttpParams localBasicHttpParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(localBasicHttpParams, 30000);
    HttpConnectionParams.setSoTimeout(localBasicHttpParams, 60000);
    HttpConnectionParams.setTcpNoDelay(localBasicHttpParams, true);
    HttpProtocolParams.setUserAgent(localBasicHttpParams, getDefaultUserAgent());
    DefaultHttpClient localDefaultHttpClient = new DefaultHttpClient(localBasicHttpParams);
    localDefaultHttpClient.setKeepAliveStrategy(new DefaultConnectionKeepAliveStrategy());
    localDefaultHttpClient.setReuseStrategy(new DefaultConnectionReuseStrategy());
    return localDefaultHttpClient;
  }

  public static String getFileRemoteUrl(String paramString)
  {
    if (paramString.startsWith("http"))
      return paramString;
    String str = getFileDirRemoteUrl();
    str = str + paramString;
    return str;
  }

  public static String getFileDirRemoteUrl()
  {
    String str = getBaseUrlByAppKey();
    str = str + "/chatfiles/";
    return str;
  }

  public static String getBaseUrlByAppKey()
  {
    f.c localc = f.a().c();
    String str = "http://";
    if ((localc.c != null) && (!localc.c.equals("")) && (localc.c.equals("https")))
      str = "https://";
    str = str + localc.a + ":" + localc.b;
    if (!str.endsWith("/"))
      str = str + "/";
    str = str + EMChatConfig.getInstance().APPKEY.replaceFirst("#", "/");
    return str;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     com.easemob.cloud.HttpClientConfig
 * JD-Core Version:    0.6.1
 */